package com.juyu.miliao.common.constant;

import lombok.Getter;

/**
 * 动态评论redis key
 *
 * @author xuanqicheng
 * @create 2019-21-13:12
 */
public interface DynamicCommentInfoRedisKey {


    /**
     * 根据评论id,查询对应回复
     */
    enum CommentReplyInfoByCommentId{
        /**
         * 根据评论id,查询对应回复
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicCommentReplyInfoByCommentId:%s",
                "根据评论id,查询对应回复");

        private String key;

        @Getter
        private String message;

        CommentReplyInfoByCommentId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long commentId){

            return String.format(REDIS_KEY.key,commentId);
        }
    }


    enum DynamicCommentByCommentId{
        /**
         * 根据评论id,查询对应评论
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicCommentByCommentId:%s",
                "根据评论id,查询对应评论");

        private String key;

        @Getter
        private String message;

        DynamicCommentByCommentId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long commentId){

            return String.format(REDIS_KEY.key,commentId);
        }
    }

    enum DynamicCommentPageByDynamicId{
        /**
         * 根据动态id,分页查询对应评论
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicCommentPageByCommentId:%s",
                "根据动态id,分页查询对应评论"),

        HASH_KEY("DynamicComment:%s:%s","分页数据");

        private String key;

        @Getter
        private String message;

        DynamicCommentPageByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long commentId){

            return String.format(REDIS_KEY.key,commentId);
        }

        public String getHashKeyFormat(int page,int pageSize){

            return String.format(HASH_KEY.key,page,pageSize);
        }

    }

    enum DynamicCommentCountByDynamicId{
        /**
         * 根据评论id,查询对应评论总条数
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicCommentCountByDynamicId:%s",
                "根据动态id,查询对应评论总条数");

        private String key;

        @Getter
        private String message;

        DynamicCommentCountByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }

    }
}
